//
//  UIView+ZLAdditional.m
//
//  Created by Jiaozl on 2022/1/23.
//  
//

#import "UIView+ZLAdditional.h"

@implementation UIView (ZLAdditional)

- (CGFloat)centerX {
    return self.center.x;
}

- (void)setCenterX:(CGFloat)xma_centerX {
    CGPoint center = self.center;
    self.center = CGPointMake(xma_centerX, center.y);
}


- (CGFloat)left {
    return self.frame.origin.x;
}

- (void)setLeft:(CGFloat)xma_left {
    CGRect rect = self.frame;
    rect.origin.x = xma_left;
    self.frame = rect;
}

- (CGFloat)right {
    return self.frame.origin.x + self.frame.size.width;
}

- (void)setRight:(CGFloat)xma_right {
    CGRect rect = self.frame;
    rect.origin.x = xma_right - rect.size.width;
    self.frame = rect;
}

- (CGFloat)width {
    return self.bounds.size.width;
}

- (void)setWidth:(CGFloat)xma_width {
    CGRect rect = self.frame;
    rect.size.width = xma_width;
    self.frame = rect;
}

- (CGSize)size {
    return self.bounds.size;
}

- (void)setSize:(CGSize)xma_size {
    CGRect rect = self.frame;
    rect.size = xma_size;
    self.frame = rect;
}

@end
